package cn.ustb.dao;

import cn.ustb.entity.TeacherInformation;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface TeacherDao {
    @Select("SELECT * FROM teacherinformation")
    List<TeacherInformation> getAll();

    @Select("select *from teacherinformation where teacherId = #{studentId}")
    TeacherInformation get(String teacherId);

    @Insert("insert into teacherinformation values(#{teacherId},#{teacherName},#{gender},#{politicStatus},#{nation},#{nativePlace},#{academy},#{profession},#{phone},#{email},#{address})")
    void insert(TeacherInformation teacherInformation);

    @Update("update teacherinformation set TeacherName =#{teacherName} ,Gender = #{gender}, Politicstatus =#{politicStatus} ,Nation = #{nation}, Nativeplace = #{nativePlace}, Academy =#{academy}, Profession =#{profession}, Phone = #{phone}, Email =#{email} Address =#{address} where teacherId =#{teacherId}")
    void update(TeacherInformation teacherInformation);

    @Delete("delete from teacherinformation where teacherId =#{teacherId}")
    void delete(String teacherId);

    @Select("select count(*) from teacherinformation where teacherId =#{teacherId}")
    List<TeacherInformation> getCountWithName(@Param("teacherId") String teacherId);
}
